import http from './interface'

export const weather_now = (cityId) => {
	return http.request({
		baseUrl: "http://aliv18.data.moji.com",
		header: {
			'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
			'Authorization': 'APPCODE 277ec4ab3a3747dcbd6de6f4687e5fb5'
		},
		url: '/whapi/json/alicityweather/condition',
		data: {
			cityId: cityId,
			token: "50b53ff8dd7d9fa320d3d3ca32cf8ed1"
		},
		responseType: 'json',
		dataType: 'json',
		method: 'POST',
	})
}
export const weather_life = (location) => {
	return http.request({
		url: '/api/weather/life',
		data: {
			location: location
		},
		dataType: 'json',
		method: 'POST',
	})
}

export const weather_day = (location) => {
	return http.request({
		url: '/api/weather/day',
		data: {
			location: location
		},
		dataType: 'json',
		method: 'POST',
	})
}
export const weather_talk = (location) => {
	return http.request({
		url: '/api/weather/talk',
		data: {
			location: location
		},
		dataType: 'json',
		method: 'POST',
	})
}
export const weather_city = (location) => {
	return http.request({
		url: '/api/weather/city',
		data: {
			location: location
		},
		dataType: 'json',
		method: 'POST',
	})
}

export const device_token = (location) => {
	return http.request({
		baseUrl: "http://www.0531yun.com",
		header: {
			'Content-Type': 'application/json; charset=UTF-8',
		},
		url: '/api/getToken',
		data: {
			loginName: 'h240118gnsf',
			password: 'h240118gnsf'
		},
		dataType: 'json',
		method: 'GET',
	})
}
export const device_now = (token) => {
	return http.request({
		baseUrl: "http://www.0531yun.com",
		header: {
			'Content-Type': 'application/json; charset=UTF-8',
			'authorization': token
		},
		url: '/api/data/getRealTimeData',
		dataType: 'json',
		method: 'GET',
	})
}




// 默认全部导出  import api from '@/common/vmeitime-http/'
export default {
	weather_now,
	weather_day,
	weather_life,
	weather_talk,
	weather_city,
	device_token,
	device_now,
}